using System;
using System.DHTML;
using Ext;

namespace SampleScripts.resizable {
    public class BasicScript {
        public static void main(Dictionary args) {
            ExtClass.onReady(new AnonymousDelegate(delegate() { new BasicScript().init(); }));
        }

        public void init() {
			new Resizable("basic", new ResizableConfig()
				.width(200)
				.height(100)
				.minWidth(100)
				.minHeight(50)
				.ToDictionary());

			new Resizable("animated", new ResizableConfig()
				.width(200)
				.pinned(true)
				.height(100)
				.minWidth(100)
				.minHeight(50)
				.animate(true)
				.easing("backIn")
				.custom("duration", .6)
				.ToDictionary());
	        
			new Resizable("wrapped", new ResizableConfig()
				.wrap(true)
				.pinned(true)
				.minWidth(50)
				.minHeight(50)
				.preserveRatio(true)
				.ToDictionary());
	        
			new Resizable("transparent", new ResizableConfig()
				.wrap(true)
				.minWidth(50)
				.minHeight(50)
				.preserveRatio(true)
				.transparent(true)
				.ToDictionary());
	        
			Resizable custom = new Resizable("custom", new ResizableConfig()
				.wrap(true)
				.pinned(true)
				.minWidth(50)
				.minHeight(50)
				.preserveRatio(true)
				.handles("all")
				.draggable(true)
				.dynamic(true)
				.ToDictionary());
			
			Element customEl = custom.getEl();
			// move to the body to prevent overlap on my blog
			Document.Body.InsertBefore(customEl.dom, Document.Body.FirstChild);
	        
			customEl.on("dblclick", new AnonymousDelegate(delegate
				{
					customEl.hide(true);
				}));
			customEl.hide();
	        
			ExtClass.get("showMe").on("click", new AnonymousDelegate(delegate
				{
					customEl.center();
					customEl.show(true);
				}));
	        
			new Resizable("dwrapped", new ResizableConfig()
				.wrap(true)
				.pinned(true)
				.width(450)
				.height(150)
				.minWidth(200)
				.minHeight(50)
				.dynamic(true)
				.ToDictionary());
	        
			new Resizable("snap", new ResizableConfig()
				.wrap(true)
				.width(250)
				.height(100)
				.handles("e")
				.widthIncrement(50)
				.minWidth(500)
				.dynamic(true)
				.ToDictionary());
       }
    }
}
